﻿@{
    Layout = null;
}

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>@ViewBag.typename</title>
    <link href="../../Content/layout.css" rel="stylesheet" />
    <link href="~/Content/NavPager.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-1.8.0.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            initTable();
        })

        //初始化表格
        function initTable(postData) {
            if (postData==null || postData=="") {
                postData = "typeid=" + GetQueryString("typeid");
            }
            $.getJSON("GetPageType", postData, function (jsondate) {
                $("#newslist").html("");
                var strTr =""
                for (var i in jsondate.Data.NewsList) {
                    var time = eval('new ' + (jsondate.Data.NewsList[i].addtime.replace(/\//g, '')));


                    strTr += "<li><a href=\"newsdetail?id= " + jsondate.Data.NewsList[i].id + " \"> " + jsondate.Data.NewsList[i].title + "  </a>  <span style=\"float:right; margin-right:50px;\">   " + time.format("MM-dd") + " </span></li>";

                }
                $("#newslist").append(strTr);

                //把分页的标签放到页面里面去
                $("#navDiv").html(jsondate.Data.NavHtml);

                //给分页的超级链接绑定点击事件
                $(".pageLink").click(function () {
                    var href = $(this).attr("href");
                    var queryString =  "typeid=" +GetQueryString("typeid")+"&";
                    queryString = queryString+href.substr(href.lastIndexOf('?') + 1);
                    initTable(queryString);
                    return false;
                });
            });
        }



        //获取地址栏的参数
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]); return null;
        }

        //json 时间转换方法
        Date.prototype.format = function (format) {
            /*
             * format="yyyy-MM-dd hh:mm:ss";
             */
            var o = {
                "M+": this.getMonth() + 1,
                "d+": this.getDate(),
                "h+": this.getHours(),
                "m+": this.getMinutes(),
                "s+": this.getSeconds(),
                "q+": Math.floor((this.getMonth() + 3) / 3),
                "S": this.getMilliseconds()
            };
            if (/(y+)/.test(format)) {
                format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
            }
            for (var k in o) {
                if (new RegExp("(" + k + ")").test(format)) {
                    format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
                }
            }
            return format;

        };

    </script>



</head>

<body>
    <div id="container">
        <div id="header">
            <div id="logo"><img src="../../images/logo.gif" alt="企业名称" width="181" height="45" /></div>
            <div id="search" style="display:none">
                <form id="form1" name="form1" method="post" action="">
                    搜索产品
                    <input class="inp_srh" type="text" name="textfield" id="textfield" />
                    <input class="btn_srh" type="submit" name="button" id="button" value="查询" />
                </form>
            </div>
        </div>
        <div class="clearfloat"></div>
        <div id="nav">
            <div id="nav_l"></div>
            <div id="nav_r"></div>
            <div class="nav_main">
                <ul>
                    <li><a href="~/home/index"><span>首页</span></a></li>
                    @foreach (var item in (List<Models.NewsType>)ViewBag.newstype)
                    {
                        <li><a href="ntype?typeid=@item.id"><span>@item.typeName </span></a></li>
                    }

                </ul>
            </div>

        </div>
        <div class="clearfloat"></div>
        <div id="maincontent">
            <div id="main">
                <div class="box_plist">
                    <h2><span>@ViewBag.typename </span></h2>
                    <div class="box_list">
                        <ul id="newslist"></ul>
                    </div>
                </div>

                <div class="paginator" id="navDiv">  </div>

            </div>

            <div id="side">

                <div class="side_box">
                    <h2>本类阅读<strong>排行</strong></h2>
                    <div class="side_con ask">
                        @foreach (var item in (List<Models.NewsContent>)ViewBag.newsHot)
                        {
                            <dl>
                                <dt><a href="newsdetail?id=@item.id">@item.title</a></dt>
                            </dl>
                        }


                    </div>
                </div>
                <div class="side_box">
                    <h2><strong>联系</strong>我们</h2>
                    <div class="side_con contact"><img src="../../images/tel.gif" alt="联系我们" width="222" height="112" /></div>
                </div>
            </div>
        </div>
        <div class="clearfloat"></div>
        <div id="footer" style="background-color:silver">
            <dl>
                <dt><a href="#">关于我们</a>　||　<a href="#">产品目录</a>　||　<a href="#">联系我们</a>　||　<a href="#">友情链接</a>　||　<a href="#">反馈问题</a>　||　<a href="#">广告合作</a></dt>
                <dd>
                    Copyright &copy; 2007 - 2010 aa25.cn   All Rights Reserved<br />
                    标准之路  版权所有  京ICP备10007159号
                </dd>
            </dl>
        </div>
    </div>
</body>
</html>
